Results 1 to 4 of 4

Thread: Dynamic Melt Points

  1. #1

    Default Dynamic Melt Points

    Hey All,

    I'm trying to make our Freeze-Tag server adjust the number of melts necessary before a team wins the map based on the number of players on that team. I'm using parts of Purple's team balance mod to achieve this but the script isn't working. Here is the script:

    Code:
    main:
    thread count_players
    thread setup_huds
    thread teamwin_check
    end
    
    count_players:
    
     /// resets counts
    local.count[spectator] = 0;
    local.count[allies] = 0;
    local.count[axis] = 0;
    
    
    
    		/// Now counts players
    		for (local.i = 1; local.i <= $player.size; local.i++) {
    			local.count[$player[local.i].dmteam]++;
    		}
    		
    while(1)
    {
    	if local.count[allies] >= 1 && local.count[allies] <= 4
    	{
    	setcvar "allies_needed" "20"
    	}		
    	
    	if local.count[allies] >= 5 && local.count[allies] <= 7
    	{
    	setcvar "allies_needed" "50"
    	}
    		
    	if local.count[allies] >= 8 && local.count[allies] <= 10
    	{
    	setcvar "allies_needed" "75"
    	}
    	
    	if local.count[allies] >= 11 && local.count[allies] <= 13
    	{
    	setcvar "allies_needed" "90"
    	}
    
    	if local.count[allies] >= 14 && local.count[allies] <= 16
    	{
    	setcvar "allies_needed" "110"
    	}	
    	
    	if local.count[axis] >= 1 && local.count[axis] <= 4
    	{
    	setcvar "axis_needed" "20"
    	}		
    	
    	if local.count[axis] >= 5 && local.count[axis] <= 7
    	{
    	setcvar "axis_needed" "50"
    	}
    		
    	if local.count[axis] >= 8 && local.count[axis] <= 10
    	{
    	setcvar "axis_needed" "75"
    	}
    	
    	if local.count[axis] >= 11 && local.count[axis] <= 13
    	{
    	setcvar "axis_needed" "90"
    	}
    
    	if local.count[axis] >= 14 && local.count[axis] <= 16
    	{
    	setcvar "axis_needed" "110"
    	}		
    
    wait 5
    }
    
    //Updates huds
    huddraw_string 220 ("Allies = " + local.count[allies] + " / " + getcvar(allies_needed))
    huddraw_string 217 ("Axis  = " + local.count[axis] +  " / " + getcvar(axis_needed))	
    
    waitframe
    
    end
    
    setup_huds:
    //// Sets up HUDs
    
    huddraw_font 217 "verdana-12"
    huddraw_alpha 217 0.8
    huddraw_color 217 1 0 0
    huddraw_align 217 center center
    huddraw_rect 217 270 -180 10 10
    huddraw_string 217 ("Axis  = ")
    huddraw_virtualsize 217 1
    
    // Axis total count
    huddraw_alpha 218 0.8
    huddraw_align 218 center center
    huddraw_virtualsize 218 1
    huddraw_rect 218 250 -180 10 10
    huddraw_shader 218 ("textures/hud/axis")
    
    // Allies Total Count
    huddraw_alpha 219 0.8
    huddraw_align 219 center center
    huddraw_virtualsize 219 1
    huddraw_rect 219 250 -160 10 10
    huddraw_shader 219 ("textures/hud/allies")
    
    huddraw_font 220 "verdana-12"
    huddraw_alpha 220 0.8
    huddraw_color 220 0.576471 0.858824 0.439216
    huddraw_align 220 center center
    huddraw_rect 220 270 -160 10 10
    huddraw_string 220 ("Allies =")
    huddraw_virtualsize 220 1
    
    end
    
    teamwin_check:
    while(1)
    {
    	if(level.alliesmelt == getcvar(allies_needed))
    {
    	wait .25
    	local.team = "allies"
    	thread teamwin local.team
    
    }
    
    	if(level.axismelt == (getcvar(axis_needed)))
    {
    	wait .25
    	local.team = "axis"
    	thread teamwin local.team
    
    }
    
    waitframe
    }
    end
    
    
    teamwin local.team:
    	local.gametype = getcvar g_gametype
    	wait .01
    	setcvar "g_gametype" "4"
    	teamwin local.team
    	setcvar "g_gametype" local.gametype
    end

    Logfile:

    Code:
    g_gametype will be changed upon restarting.
    ------ Server Initialization ------
    Server: dm/mohdm1
    LoadLibrary (main/gamex86.dll)
    
    
    ------------------ MoH:AA 1.12 Reborn Patch InitGame ------------------ 
    Initializing CVARS. Done!
    Performing game and patch files integrity check...
    --> MoHAA Server Hash: 6e6c402831306025d75ada19a66fc156
    --> Gamex86 Hash:      06546e0c5345617b22a340c85110b574
    --> mohaa_server.exe file valid!
    --> gamex86mohaa.dll file valid!
    --> Next update check will be performed after 11 hours (0 day/s)!
    Initializing Chat Filter. Done!
    Initializing Banned Names List. Done!
    Initializing Banned IPs List. Done!
    Initializing Allowed Votes List. Done!
    Initializing Allowed Maps List. Done!
    Initializing Admins List. Done!
    Initializing Protected Names List. Done!
    Reborn.map mapped into address space. Shared settings initialized!
    LocalizationError fix Address: 0x0043bb24
    LocalizationError removal fix applied.
    G_BulletAttack Address: 0x31176e10
    G_BulletAttack: Hooked correctly.
    SV_AddEntitiesVisibleFromPoint Address: 0x434520
    Anti Wallhack/Visuals Protection applied
    Black Window Patch Address: 0x31177655
    Shoot through Black Window/Furniture/Light Bulbs Hack Protection applied
    RConFlood Patch Address: 0x432fc1
    RConFlood Crash Protection applied
    InfoBoom Patch Address: 0x421ba3 & 0x421b4e
    InfoBoom Patch Address: 0x421ba3
    InfoBoom Crash Protection applied
    MoH:AA BOF (Buffer Overflow) Address: 0x428fad
    MoH:AA BOF (Buffer Overflow) Crash Protection applied
    SV_UpdateUserinfo_f Address: 0x42f0f0
    UserInfo Buffer overflow protection applied (512 chars limit)
    Player::CondMinChargeTime CallAddress: 0x3112cb31
    Grenade Drop&Charge Crash Protection applied
    Player::PreviousWeapon Infinite Loop Crash Protection applied
    Player::NextWeapon Infinite Loop Crash Protection applied
    ScriptedEvents System Initialized
    Kick/Ban Announcements Initialized
    Internal Packet Flood Protection Initialized
    Allowed remote tool IP: 127.0.0.1 (7f000001)
    ---------------- MoH:AA 1.12 Reborn Patch InitFinished ----------------
    
    
    ==== InitGame ====
    sizeof(Actor) == 2960
    Magic sizeof actor numer: 2896
    
    ------------------
    Event system initialized: 154 classes 1390 events 856240 total memory in response list
    
    ==== CleanupGame ====
    CM_LoadMap( maps/dm/mohdm1.bsp, 0 )
    ^~^~^ Can't find textures/general_industrial/deckgrate_set1b.tga
    Loading Reborn Loader...
    ScriptMaster::ExecuteThread: Can't find 'reborn/reborn_loader.scr'
    Adding script: 'dm/mohdm1_precache.scr'
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'realism' does not exist.
    ^~^~^ Event 'realism' does not exist.
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'realism' does not exist.
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'realism' does not exist.
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'realism' does not exist.
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'realism' does not exist.
    ^~^~^ Event 'realism' does not exist.
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'sprealism' does not exist.
    ^~^~^ Event 'dmrealism' does not exist.
    ^~^~^ Event 'sp' does not exist.
    ^~^~^ Event 'dm' does not exist.
    ^~^~^ Event 'sprealism' does not exist.
    ^~^~^ Event 'dmrealism' does not exist.
    Skeletor CacheAnimSkel: Could not open binary file models/weapons/KAR98/KAR98_empty.skc
    TIKI_InitTiki: Failed to load animation 'models/weapons/KAR98/KAR98_empty.skc' at models/weapons/kar98.tik, line: 112
    Skeletor CacheAnimSkel: Could not open binary file models/weapons/KAR98/KAR98_reload.skc
    TIKI_InitTiki: Failed to load animation 'models/weapons/KAR98/KAR98_reload.skc' at models/weapons/kar98.tik, line: 113
    TIKI_InitTiki: could not find surface 'panzerschreck2' in 'models/weapons/panzerschreck.tik' (check referenced skb/skd files).
    ^~^~^ Can't find models/player/allied_oss.tik
    Tiki:LoadFile Couldn't load models/player/allied_oss.tik
    ^~^~^ Can't find models/player/allied_oss_fps.tik
    Tiki:LoadFile Couldn't load models/player/allied_oss_fps.tik
    ^~^~^ Can't find models/player/german_elite_gestapo.tik
    Tiki:LoadFile Couldn't load models/player/german_elite_gestapo.tik
    ^~^~^ Can't find models/player/german_elite_gestapo_fps.tik
    Tiki:LoadFile Couldn't load models/player/german_elite_gestapo_fps.tik
    Channel named Bip01 L Clavicle pos not added. (Bone will not work without it)
    Channel named Bip01 R Clavicle pos not added. (Bone will not work without it)
    ^~^~^ Can't find models/player/german_winter1.tik
    Tiki:LoadFile Couldn't load models/player/german_winter1.tik
    ^~^~^ Can't find models/player/german_winter1_fps.tik
    Tiki:LoadFile Couldn't load models/player/german_winter1_fps.tik
    ^~^~^ Can't find models/player/german_winter2.tik
    Tiki:LoadFile Couldn't load models/player/german_winter2.tik
    ^~^~^ Can't find models/player/german_winter2_fps.tik
    Tiki:LoadFile Couldn't load models/player/german_winter2_fps.tik
    exec BRATSMODS/TABINFO.scr (global/dmprecache.scr, 70)
    ^
    
    ^~^~^ Script Error: Can't find 'bratsmods/tabinfo.scr'
    
    bad token:
    TOKEN_GREATER_THAN_OR_EQUAL:
    >=
    
    	if local.count[allies] >= 1 && local.count[allies] <= 4 (global/dmelts.scr, 32)
    	if local.count[allies] ^
    
    ^~^~^ Script file compile error:  Couldn't parse 'global/dmelts.scr'
    ScriptMaster::GetScript: Script 'global//dmelts.scr' was not properly loaded
    
    -------------------- Spawning Entities -----------------------
    soundtrack switched to .
    ^~^~^ Event 'sunflare' does not exist.
    ^~^~^ Failed execution of event for class 'World'
    -------------------- Actual Spawning Entities -----------------------
    -------------------- Actual Spawning Entities Done ------------------ 2 ms
    0 teams with 0 entities
    Adding script: 'dm/mohdm1.scr'
    ^~^~^ Add the following line to the *_precache.scr map script:
    cache models/fx/dummy.tik
    Adding autosave names
    33 entities spawned
    94 simple entities spawned
    0 entities inhibited
    -------------------- Spawning Entities Done ------------------ 76 ms
    
    
    -----------PARSING UBERSOUND (SERVER)------------
    Any SetCurrentTiki errors means that tiki wasn't prefetched and tiki-specific sounds for it won't work. To fix prefetch the tiki. Ignore if you don't use that tiki on this level.
    CG_Command_ProcessFile: ubersound/ubersound.scr
    Parse/Load time: 0.029000 seconds.
    -------------UBERSOUND DONE (SERVER)---------------
    
    
    
    -----------PARSING UBERDIALOG (SERVER)------------
    Any SetCurrentTiki errors means that tiki wasn't prefetched and tiki-specific sounds for it won't work. To fix prefetch the tiki. Ignore if you don't use that tiki on this level.
    CG_Command_ProcessFile: ubersound/uberdialog.scr
    Parse/Load time: 0.114000 seconds.
    -------------UBERDIALOG DONE (SERVER)---------------
    
    ------ Server Initialization Complete ------  1.39 seconds
    	huddraw_rect   1 0 (global/melt_hud.scr, 145)
    	^
    
    ^~^~^ Script Error: Wrong number of arguments for huddraw_rect.
    
    
    	huddraw_color  1 0 (global/melt_hud.scr, 146)
    	^
    
    ^~^~^ Script Error: Wrong number of arguments for huddraw_color.
    
    
    	huddraw_rect   2 0 (global/melt_hud.scr, 151)
    	^
    
    ^~^~^ Script Error: Wrong number of arguments for huddraw_rect.
    
    
    	huddraw_color  2 0 (global/melt_hud.scr, 152)
    	^
    
    ^~^~^ Script Error: Wrong number of arguments for huddraw_color.
    
    
    exec global/dMelts.scr (global/melt_hud.scr, 3)
    ^
    
    ^~^~^ Script Error: Script 'global/dMelts.scr' was not properly loaded
    
    
    soundtrack switched to music/mohdm1.mus.
    playing music/mohdm1.mus
    music set to normal with fallback normal
    Loading Ambient.scr
    Hitch warning: 1492 msec frame time
    SV packet 173.25.161.9:7130 : getstatus
    SV packet 98.244.212.76:7130 : getstatus
    ----- Server Shutdown -----
    broadcast: print "Server quit\n"
    
    
    ------------------ MoH:AA 1.12 Reborn Patch Shutdown ------------------ 
    Shared settings memory deinitialized correctly.
    LocalizationError removal fix shutdown.
    G_BulletAttack: Unhooked correctly.
    Anti Wallhack/Visuals protection shutdown
    UserInfo Buffer overflow protection shutdown
    RConFlood Crash Protection shutdown
    InfoBoom Crash Protection shutdown
    MoH:AA BOF (Buffer Overflow) Crash Protection shutdown
    Grenade Throw Crash Protection shutdown
    Player::PreviousWeapon Infinite Loop Crash Protection shutdown
    Player::NextWeapon Infinite Loop Crash Protection shutdown
    Kick/Ban Announcements Deinitialized
    ScriptedEvents System Deinitialized
    ScriptedTimers System Deinitialized
    Internal Packet Flood Protection Deinitialized
    ----------------- MoH:AA 1.12 Reborn Patch ShutdownEnd ---------------- 
    
    
    ==== ShutdownGame ====
    ---------------------------

    Maybe there's a better way to go about this entirely, like just taking total number of players less the number of players in spec and setting the "needed" melts based on that number.. I'm open to ideas -- stumped as it is now.

  2. #2
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    You are missing the parentheses in the if statements

    If(local.count[allies] >= 1 && local.count[allies] <= 4)
    {
    Set cvars etc...
    }

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  3. #3
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,566

    Default

    Lol dude ur if brackets are not there hehe.


    *Edited due to bad language*
    Last edited by Shadow; April 23rd, 2016 at 02:56 AM.

  4. #4

    Default

    Quote Originally Posted by RyBack View Post
    Lol dude ur if brackets are not there hehe.
    So eloquent, RyBack!

    Thanks guys. That seems to have done the trick.
    Last edited by Shadow; April 23rd, 2016 at 02:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •